package com.example.lambda;

import javax.swing.*;
import java.awt.*;

/**
 * @author MikeW
 */
public class ListenerTest {
    public static void main(String[] args) {

        JButton testButton = new JButton("Test Button");
        testButton.addActionListener(ae -> System.out.println("Click Detected by Anon Class"));

        //testButton.addActionListener(e -> System.out.println("Click Detected by Lambda Listener"));
        testButton.addActionListener(e -> System.out.println("Click Detected by Lambda Listener"));

        // Swing stuff
        JFrame frame = new JFrame("Listener Test");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.add(testButton, BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);

    }
}
